<?php
ini_set('display_errors',1);

if (isset($_POST["PHPSESSID"])) {
    session_id($_POST["PHPSESSID"]);
}
session_start();

try {


	$m  = new Mongo();
	$db = $m->gshow;
	$grid = $db->getGridFS();

	$cursor = $grid->find();
	
	$pic_lists = array();
	
	foreach ($cursor as $obj) {
		
		$tmp['url'] = "http://192.168.2.118/gridfs_getfile.php?filename=".$obj->getFilename();
		$tmp['file_name'] = $obj->getFilename();	
		$pic_lists[] = $tmp;
	}
	
	$m->close();
	
} catch(Exception $e) {
       echo $e->message();
}
	
	//var_dump($pic_lists);
	echo json_encode($pic_lists);
	

